package cn.tedu.spring.eg3;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Scope(value = "singleton")
@Component
public class ShopController {

    private String name;

    public ShopController()
    {
        System.out.println("ShopController(),实例化");
    }

    @Value("小明")
    public void setName(String name)
    {
        System.out.println("setName(),bean对象赋值");
        this.name = name;
    }

    @PostConstruct
    public void init()
    {
        System.out.println("init(),初始化");
    }

    @PreDestroy
    public void destroy()
    {
        System.out.println("destroy(),对象销毁");
    }



}
